import { addAPIProvider, disableCache } from '@iconify/vue';

/** Setup the iconify offline */
export function setupIconifyOffline() {
  const { VITE_ICONIFY_URL } = import.meta.env;

  if (VITE_ICONIFY_URL) {
    addAPIProvider('', { resources: [VITE_ICONIFY_URL] });
    disableCache('all');
  } else {
    // 如果没有配置 VITE_ICONIFY_URL，使用默认的 Iconify API
    addAPIProvider('', {
      resources: [
        'https://api.iconify.design',
        'https://icon-sets.iconify.design',
        'https://raw.githubusercontent.com/iconify/icon-sets/master/json'
      ]
    });
  }
}
